#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>

int main (void)
{
	pid_t pid;
	//const char *path[] = {"ps", "-o", "pid,ppid,pgrp,session,comm", NULL};

	pid = fork ();
	if (-1 == pid)
	{
		perror("fork()");
		return -1;
	}
	if (0 == pid) {
		//execl ("/usr/bin/ps", "ps", "-o", "pid,ppid,pgrp,session,comm", NULL);
		execlp ("ps", "ps", "-o", "pid,ppid,pgrp,session,comm", NULL);
		perror ("execlp()");
		exit(0);
	} else {
		wait(NULL);
	}
	return 0;
}
